
#include <unistd.h>
#include "iostream"
#include "pthread.h"

#include "src/prims/jni.h"
#include "src/runtime/atomic.hpp"

volatile jint t = 20000;

void*  func(void *arg){
    int i=0;
    while(i++<1000){
       Atomic::dec(&t);
       usleep(1);
    }
}

int main(){


   pthread_t idArr[20] = {0};
   for(int i=0;i<20;i++){
      int ret = pthread_create(&idArr[i],NULL,func,NULL);
   }


   sleep(10);

   std::cout << t << std::endl;


   return 0;
}